﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TabAddFreePlayer.ascx.cs" Inherits="BigLotterySyndicate.Secured.Draws.Controls.TabAddFreePlayer" %>
<asp:MultiView ID="MultiViewList" runat="server">
<asp:View ID="ViewList" runat="server">
<table cellpadding="2" cellspacing="2">
<thead>
<tr>
<th>&nbsp;</th>
<th class="left">Player name</th>
<th>
<script type="text/javascript">
    document.write("<input type='checkbox' id='CheckboxToggleParent' onclick='ToggleAllCheckboxes(this)'/>");

    function ToggleAllCheckboxes(el) {
        var state = el.checked;
        while (el && el.tagName.toLowerCase() != "table") {
            el = el.parentNode;
        }
        if (el) {
            var inputs = el.getElementsByTagName("input");
            for (var idx = 0; idx < inputs.length; idx++) {
                if (inputs[idx].id != "CheckboxToggleParent" && inputs[idx].type.toLowerCase() == "checkbox")
                    inputs[idx].checked = state;
            }
        }
    }
                            </script>
                            <noscript>&nbsp;</noscript>
</th>
</tr>
</thead>
<tbody>
<asp:Repeater ID="RepeaterList" runat="server">
    <ItemTemplate>
    <tr>
        <td><%# Container.ItemIndex+1 %>.</td>
        <td><%# PrintPlayerName(Container.DataItem) %></td>
        <td><input type="checkbox" runat="server" id="chkAction"/></td>
    </tr>
    </ItemTemplate>
</asp:Repeater>
</tbody>
</table>
<asp:Button ID="SubmitButton" CssClass="Button float-right" runat="server" 
        Text="Add selected players to this draw." TabIndex="8" 
        onclick="SubmitButton_Click"  />

</asp:View>
<asp:View ID="ViewEmpty" runat="server">
<p>No more users can be added to this draw.</p>
</asp:View>
</asp:MultiView>